<?php
    class registrationController extends Model {
        public function init(){
           $this->m->addCSS("new")->addCSS("common_page");
           $this->m->addJS("mainpage");
        }
        
        public function indexAction(){
         
          
        }
        
        public function checkRegistrationAction(){
            
        if($_SERVER['REQUEST_METHOD'] !='POST') return;
            $this->disableTemplate();
            $this->disableView();
            xload('class.users');
            $users=new Users($this->m);
            parse_str($_POST['regdata'], $regdata);
            $status=$users->registration($regdata['user']);
            if($status==null){
                $status=$this->m->_auth->ajaxLogin("/",$regdata['user']['email'],$regdata['user']['password']);
            }else{
                $status->status="failed";
                
            }
            echo json_encode($status);
            
            
            
        }
        
        public function regFormAction(){
           $this->disableTemplate();
        }
        public function logFormAction(){
           $this->disableTemplate();
        }
    }
?>